91d25b
@@ -498,9 +498,10 @@
private Path processPathDepthInfo(final PathDepthInfo pd)
             } else if (!parts[0].equalsIgnoreCase(partColNames.get(currentDepth))) {
               logOrThrowExceptionWithMsg(
                   "Unexpected partition key " + parts[0] + " found at " + nextPath);
+            } else {
+              // add sub-directory to the work queue if maxDepth is not yet reached
+              pendingPaths.add(new PathDepthInfo(nextPath, currentDepth + 1));
             }
-            // add sub-directory to the work queue if maxDepth is not yet reached
-            pendingPaths.add(new PathDepthInfo(nextPath, currentDepth + 1));
           }
         }
         if (currentDepth == partColNames.size()) {
